﻿<!DOCTYPE html>
<html>
<?php
	include("include/session.php");
	if($session->logged_in){
?>


<head>
<title>Documents</title>
<style type="text/css">
		.auto-style1 {
			color: #000000;
			font-family: "Lao UI";
			font-size: medium;
		}
		.auto-style3 {
			color: red;
			font-family:"Lao UI";
			font-size:x-large;
			text-align: center;
			font-weight:bold;
			text-decoration: none;
		}
		.auto-style4 {
			color:black;
			font-family:"Lao UI";
			font-size:x-large;
			text-align: center;
			font-weight:bold;
			text-decoration: none;
		}
		.auto-style5 {
			font-family: "Lao UI";
			padding-top: 10px;
			padding-bottom: 15px;
			margin-left: auto;
			margin-right: auto;
		}		
</style>
</head>

<body>
	<?php include('header.php');?>
			
	<div style="width:1000px; margin:0 auto">
	<div style="width:100%">
	<div style="float:right; width:400px">
	<div align="center">
	<br><br>
		<iframe name="new" scrolling="yes" style="width:100%; height:300px; overflow: hidden;" src="file_download.php"></iframe>
	</div>
	
	<form method="post" enctype="multipart/form-data" action="upload.php">
		<table style="height:50px" border="0" cellpadding="1" cellspacing="1" class="auto-style5">
			<tr>
				<td>
					<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
					<input align="center" name="userfile" type="file" id="userfile" class="auto-style1">
					<input align="center" name="upload" type="submit" value="Upload" class="auto-style1">
				</td>
			</tr>
		</table>
	</form>
	</div>
<?php 	
	  /* 
      Ensure user has a Resume in wms_resume table .  Pulls current fk_resume_id and
      seeker_id from session info.  Checks if a resume_id =to seeker_id exists.  If not, 
      seeker's resume row in wms_resume doesn't yet exist.  Updates fk_resume_id to 
      match seeker_id and inserts a row in wms_resume with resume_id = seeker_id.
      */
	  $resume_id = $session->resume_id;
      $seeker_id = $session->userinfo['seeker_id'];
      $fk_resume_check = "SELECT resume_id FROM ".TBL_WMS_RESUME." WHERE resume_id = '$seeker_id'";
      $fk_resume_resource = mysql_query($fk_resume_check);
      if (!$fk_resume_resource) die ("Database access failed: " . mysql_error());
      $result = mysql_fetch_array($fk_resume_resource);
  	  if($result[0] != $seeker_id){
         $update_fk_resume = "UPDATE ".TBL_WMS_SEEKER." SET fk_resume_id = '$seeker_id' WHERE seeker_id = '$seeker_id'";
         $result = mysql_query($update_fk_resume);
         if (!$result) die ("Database access failed: " . mysql_error());
         $insert_resume = "INSERT INTO ".TBL_WMS_RESUME." (resume_id) VALUES ('$seeker_id')";
         $result = mysql_query($insert_resume); 
         if (!$result) die ("Database access failed: " . mysql_error());
      }	
/*
* User has submitted form without errors and user's
* account has been edited successfully.
*/
if(isset($_SESSION['resumeedit'])){
   unset($_SESSION['resumeedit']);
   
?>
<div style="color:blue">
<?
   echo "<h3><p><b>$session->username</b>, your resume has been successfully updated.</h3> "
       ?>
       </div>
       <META HTTP-EQUIV=Refresh CONTENT="3">
       <?
}
else{
?>

<h1 style="float:left">Resume Edit : <? echo $session->username; ?></h1>
<?
if($form->num_errors > 0){
   echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
}
?>
<form action="process.php" method="POST" style="float:left">
<table align="left" border="0" cellspacing="0" cellpadding="3">

<tr><td>Education Level:</td>
<td><input type="text" name="education_level" maxlength="50" value="
<? if($form->value("education_level") == "")
{echo $session->resumeinfo['education_level'];}
else{echo $form->value("education_level");}?>">
</td></tr>

<tr><td>Certifications:</td>
<td><input type="text" name="certificate" maxlength="50" value="
<? if($form->value("certificate") == "")
{echo $session->resumeinfo['certificate'];}
else{echo $form->value("certificate");}?>">
</td></tr>

<tr><td>College Degree:</td>
<td><input type="text" name="college_degree" maxlength="50" value="
<? if($form->value("college_degree") == "")
{echo $session->resumeinfo['college_degree'];}
else{echo $form->value("college_degree");}?>">
</td></tr>

<tr><td>Major(s):</td>
<td><input type="text" name="majors" maxlength="50" value="
<? if($form->value("majors") == "")
{echo $session->resumeinfo['majors'];}
else{echo $form->value("majors");}?>">
</td></tr>

<tr><td>Primary Occupation:</td>
<td><input type="text" name="prmry_occup_exp" maxlength="50" value="
<? if($form->value("prmry_occup_exp") == "")
{echo $session->resumeinfo['prmry_occup_exp'];}
else{echo $form->value("prmry_occup_exp");}?>">
</td></tr>

<tr><td>Years of Exp. (primary):</td>
<td><input type="text" name="prmry_yrs_of_exp" maxlength="50" value="
<? if($form->value("prmry_yrs_of_exp") == "")
{echo $session->resumeinfo['prmry_yrs_of_exp'];}
else{echo $form->value("prmry_yrs_of_exp");}?>">
</td></tr>

<tr><td>Secondary Occupation:</td>
<td><input type="text" name="secndry_occup_exp" maxlength="50" value="
<? if($form->value("secndry_occup_exp") == "")
{echo $session->resumeinfo['secndry_occup_exp'];}
else{echo $form->value("secndry_occup_exp");}?>">
</td></tr>

<tr><td>Years of Exp. (secondary):</td>
<td><input type="text" name="secndry_yrs_of_exp" maxlength="50" value="
<? if($form->value("secndry_yrs_of_exp") == "")
{echo $session->resumeinfo['secndry_yrs_of_exp'];}
else{echo $form->value("secndry_yrs_of_exp");}?>">
</td></tr>

<tr><td>Other Occupation:</td>
<td><input type="text" name="other_occup_exp" maxlength="50" value="
<? if($form->value("other_occup_exp") == "")
{echo $session->resumeinfo['other_occup_exp'];}
else{echo $form->value("other_occup_exp");}?>">
</td></tr>

<tr><td>Years of Exp. (other):</td>
<td><input type="text" name="other_yrs_of_exp" maxlength="50" value="
<? if($form->value("other_yrs_of_exp") == "")
{echo $session->resumeinfo['other_yrs_of_exp'];}
else{echo $form->value("other_yrs_of_exp");}?>">
</td></tr>

<tr><td>Available Shifts:</td>
<td><input type="text" name="shift_avail" maxlength="50" value="
<? if($form->value("shift_avail") == "")
{echo $session->resumeinfo['shift_avail'];}
else{echo $form->value("shift_avail");}?>">
</td></tr>

<tr><td>Preferred Shift:</td>
<td><input type="text" name="shift_preferred" maxlength="50" value="
<? if($form->value("shift_preferred") == "")
{echo $session->resumeinfo['shift_preferred'];}
else{echo $form->value("shift_preferred");}?>">
</td></tr>

<tr><td>Additional Notes:</td>
<td><input type="text" name="additional_notes" maxlength="50" value="
<? if($form->value("additional_notes") == "")
{echo $session->resumeinfo['additional_notes'];}
else{echo $form->value("additional_notes");}?>">
</td></tr>


<tr><td colspan="2" align="right">
<input type="hidden" name="subeditresume" value="1">
<input type="submit" value="Update Resume"></td></tr>
<tr><td colspan="2" align="left"></td></tr>

<tr><td>
<?
/**
 * Just a little page footer, tells how many registered members
 * there are, how many users currently logged in and viewing site,
 * and how many guests viewing site. Active users are displayed,
 * with link to their user information.
 */
echo "<tr><td align=\"center\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br></td></tr>";
?>
</td></tr>
<tr><td>
<?
include("include/view_active.php");
?>
</td></tr>

</table>
</form>
</div>
</div>
<?
}
}
else{
?>

<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;</font>
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="lul/seeker/index.php">Sign-Up!</a></td></tr>
</table>
</form>

<?
}
?>

</body>

</html>
